<html>
<head><meta charset="utf-8"><title>capture disjoint array references · t-compiler/wg-rfc-2229 · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/index.html">t-compiler/wg-rfc-2229</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/capture.20disjoint.20array.20references.html">capture disjoint array references</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="240310281"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/capture%20disjoint%20array%20references/near/240310281" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> XAMPPRocky <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/capture.20disjoint.20array.20references.html#240310281">(May 26 2021 at 11:36)</a>:</h4>
<p>Hey folks, we were discussing borrow checking at my work, and I mentioned disjoint captures, and someone asked about whether there are plans to support capturing disjoint references to a array? E.g. Having <code>&amp;v[0]</code>, and <code>&amp;mut v[1]</code> at the same time. I was wondering if this is planned to be supported in 2021, or whether it is a future enchancement? It's referenced at the end of the "Plan" HackMD, but it doesn't give an indication , other than needing to refactor <code>UpVarListMap</code> to enable the functionality.</p>



<a name="240346037"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/capture%20disjoint%20array%20references/near/240346037" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/capture.20disjoint.20array.20references.html#240346037">(May 26 2021 at 15:46)</a>:</h4>
<p>No plans for this</p>



<a name="240347618"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/capture%20disjoint%20array%20references/near/240347618" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rocksand <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/capture.20disjoint.20array.20references.html#240347618">(May 26 2021 at 15:58)</a>:</h4>
<p>It's technically ready to be merged except for the fact that this PR <a href="https://github.com/rust-lang/rust/pull/85564">https://github.com/rust-lang/rust/pull/85564</a> is also going to get merged soon, which will add the feature gate back</p>



<a name="240347767"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/capture%20disjoint%20array%20references/near/240347767" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rocksand <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/capture.20disjoint.20array.20references.html#240347767">(May 26 2021 at 15:59)</a>:</h4>
<p>So the only thing missing at this time is to remove the feature gate (which I can't do right now, cause the other PR has been approved but not merged yet)</p>



<a name="240347825"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/capture%20disjoint%20array%20references/near/240347825" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/capture.20disjoint.20array.20references.html#240347825">(May 26 2021 at 15:59)</a>:</h4>
<p>ok -- but that other PR is no longer needed once your PR lands, right?</p>



<a name="240347950"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/capture%20disjoint%20array%20references/near/240347950" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/capture.20disjoint.20array.20references.html#240347950">(May 26 2021 at 16:00)</a>:</h4>
<p><span class="user-mention" data-user-id="116083">@pnkfelix</span> iiuc, <a href="https://github.com/rust-lang/rust/pull/85564">https://github.com/rust-lang/rust/pull/85564</a> is obviated by <a href="https://github.com/rust-lang/rust/issues/85724">#85724</a>, maybe we should just merge the latter?</p>



<a name="240347965"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/capture%20disjoint%20array%20references/near/240347965" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rocksand <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/capture.20disjoint.20array.20references.html#240347965">(May 26 2021 at 16:00)</a>:</h4>
<p>Yes, it's not needed. I just wasn't sure how easy it is to stop bors from finishing the merge</p>



<a name="240348208"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/capture%20disjoint%20array%20references/near/240348208" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/capture.20disjoint.20array.20references.html#240348208">(May 26 2021 at 16:01)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116009">nikomatsakis</span> <a href="#narrow/stream/189812-t-compiler.2Fwg-rfc-2229/topic/capture.20disjoint.20array.20references/near/240347950">said</a>:</p>
<blockquote>
<p><span class="user-mention silent" data-user-id="116083">pnkfelix</span> iiuc, <a href="https://github.com/rust-lang/rust/pull/85564">https://github.com/rust-lang/rust/pull/85564</a> is obviated by <a href="https://github.com/rust-lang/rust/issues/85724">#85724</a>, maybe we should just merge the latter?</p>
</blockquote>
<p>seems fundamentally lower risk to beta-backport <a href="https://github.com/rust-lang/rust/issues/85564">#85564</a>, no?</p>



<a name="240348444"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/capture%20disjoint%20array%20references/near/240348444" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/capture.20disjoint.20array.20references.html#240348444">(May 26 2021 at 16:03)</a>:</h4>
<p>We could solely target <a href="https://github.com/rust-lang/rust/issues/85564">#85564</a> at beta alone, ...</p>



<a name="240349062"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/capture%20disjoint%20array%20references/near/240349062" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/capture.20disjoint.20array.20references.html#240349062">(May 26 2021 at 16:07)</a>:</h4>
<p>meanwhile, PR <a href="https://github.com/rust-lang/rust/issues/85564">#85564</a> has some build failure whose log is … weird</p>



<a name="240349668"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/capture%20disjoint%20array%20references/near/240349668" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/capture.20disjoint.20array.20references.html#240349668">(May 26 2021 at 16:09)</a>:</h4>
<p>I just r-‘ed PR <a href="https://github.com/rust-lang/rust/issues/85564">#85564</a> so that we can take a moment to resolve this question</p>



<a name="240349755"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/capture%20disjoint%20array%20references/near/240349755" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/capture.20disjoint.20array.20references.html#240349755">(May 26 2021 at 16:10)</a>:</h4>
<p>of whether we should be trying to have a race between PR <a href="https://github.com/rust-lang/rust/issues/85724">#85724</a> ad PR <a href="https://github.com/rust-lang/rust/issues/85564">#85564</a></p>



<a name="240349925"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/capture%20disjoint%20array%20references/near/240349925" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/capture.20disjoint.20array.20references.html#240349925">(May 26 2021 at 16:11)</a>:</h4>
<p>So, to be completely honest: I would probably unilaterally beta-backport PR <a href="https://github.com/rust-lang/rust/issues/85564">#85564</a> as soon as it lands</p>



<a name="240350021"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/capture%20disjoint%20array%20references/near/240350021" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/capture.20disjoint.20array.20references.html#240350021">(May 26 2021 at 16:12)</a>:</h4>
<p>while I would want to at least discuss whether to beta-backport <a href="https://github.com/rust-lang/rust/issues/85724">#85724</a> with T-compiler at the triage meeting tomorrow.</p>



<a name="240350200"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/capture%20disjoint%20array%20references/near/240350200" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/capture.20disjoint.20array.20references.html#240350200">(May 26 2021 at 16:13)</a>:</h4>
<p>I can understand it being unfortunate to have one PR on the main branch and then almost immediately follow it up with another PR that undoes it</p>



<a name="240350322"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/capture%20disjoint%20array%20references/near/240350322" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/capture.20disjoint.20array.20references.html#240350322">(May 26 2021 at 16:14)</a>:</h4>
<p>and the only motivation for doing so … would be because it follows best practice of only beta-backporting things that have already landed in mainline branch</p>



<a name="240350345"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/capture%20disjoint%20array%20references/near/240350345" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/capture.20disjoint.20array.20references.html#240350345">(May 26 2021 at 16:14)</a>:</h4>
<p>Does that all sound accurate?</p>



<a name="240350578"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/capture%20disjoint%20array%20references/near/240350578" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/capture.20disjoint.20array.20references.html#240350578">(May 26 2021 at 16:16)</a>:</h4>
<p>my gut tells me to go ahead and land PR <a href="https://github.com/rust-lang/rust/issues/85564">#85564</a> (with heightened priority so that we’re not waiting another two days for bors to get around to it). <span class="user-mention" data-user-id="307184">@rocksand</span> can you talk me out of this?</p>



<a name="240350682"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/capture%20disjoint%20array%20references/near/240350682" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/capture.20disjoint.20array.20references.html#240350682">(May 26 2021 at 16:17)</a>:</h4>
<p>and also: Why not leave the feature gate guard in as part of PR <a href="https://github.com/rust-lang/rust/issues/85724">#85724</a>, at least initially?</p>



<a name="240350778"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/capture%20disjoint%20array%20references/near/240350778" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/capture.20disjoint.20array.20references.html#240350778">(May 26 2021 at 16:18)</a>:</h4>
<p>I don’t see the absence of that feature gate guard as inherently coupled to PR <a href="https://github.com/rust-lang/rust/issues/85724">#85724</a></p>



<a name="240350853"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/capture%20disjoint%20array%20references/near/240350853" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/capture.20disjoint.20array.20references.html#240350853">(May 26 2021 at 16:19)</a>:</h4>
<p>(apart from the fact that you’d need to add a separate test that enables the gate)</p>



<a name="240351220"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/capture%20disjoint%20array%20references/near/240351220" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/capture.20disjoint.20array.20references.html#240351220">(May 26 2021 at 16:21)</a>:</h4>
<p>(I’m reading the discussion of <a href="https://github.com/rust-lang/rust/issues/85561#issuecomment-847270533">why the FakeRead is wrong</a> now, to try to determine if PR <a href="https://github.com/rust-lang/rust/issues/85724">#85724</a> itself has independent motivation for a beta-backport beyond the fix to issue <a href="https://github.com/rust-lang/rust/issues/85561">#85561</a> )</p>



<a name="240355848"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/capture%20disjoint%20array%20references/near/240355848" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rocksand <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/capture.20disjoint.20array.20references.html#240355848">(May 26 2021 at 16:53)</a>:</h4>
<p>I personally have no problem with going ahead and landing <a href="https://github.com/rust-lang/rust/issues/85564">#85564</a> for now. Although I believe <a href="https://github.com/rust-lang/rust/issues/85724">#85724</a> should fix the underlying issue, it seems like we still need to have some discussion around back porting.</p>



<a name="240373580"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/capture%20disjoint%20array%20references/near/240373580" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aman Arora <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/capture.20disjoint.20array.20references.html#240373580">(May 26 2021 at 18:59)</a>:</h4>
<p>I think it makes sense to just backport the feature gaurd that <span class="user-mention" data-user-id="116083">@pnkfelix</span>  had in their PR. Adding the FakeRead changes to beta doesn't yeild any benefit to beta users.</p>
<p>Once the change has been backported we can revert it on nightly and include Roxane's changes, so that we can start testing them</p>



<a name="240375041"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189812-t-compiler/wg-rfc-2229/topic/capture%20disjoint%20array%20references/near/240375041" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189812-t-compiler/wg-rfc-2229/topic/capture.20disjoint.20array.20references.html#240375041">(May 26 2021 at 19:07)</a>:</h4>
<p>OK, I'm happ to land <a href="https://github.com/rust-lang/rust/issues/85564">#85564</a> first</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>